<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <script src="../js/jquery-3.6.0.min.js"></script>
    <style>
        .wrap {
            padding: 10px;
        }

        .buttons {
            margin-bottom: 10px;
        }

        .slide {
            width: 1100px;
            height: 100px;
            border: 1px solid #333;
            position: relative;
            border-top: 0;
            margin-bottom: 10px;
        }

        .ball {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: #6ff;
            position: absolute;
            left: 0;
            top: 0;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <div class="buttons">
            <button>开始</button>
        </div>
        <div class="slide">
            <div class="ball"></div>
        </div>
        <div class="slide">
            <div class="ball"></div>
        </div>
        <div class="slide">
            <div class="ball"></div>
        </div>
        <div class="slide">
            <div class="ball"></div>
        </div>
    </div>
</body>

<script>
    // 以前原生
    // animate(ele, attr, end, type, callback)
    // => animate(box,"left",1000,"linear",function(){})

    // $(ele).animate(params, speed, callback);
    // ele     运动的元素
    // params  运动的属性及其终点值
    // speed   速度(slow normal fast  自定义运动时间(ms))
    // callback  本次运动结束执行的回调函数


    $("button").click(function () {
        $(".ball").eq(0).animate({ left: 1000 }, "slow", function () {
            console.log("本次运动结束1");
        })
        $(".ball").eq(1).animate({ left: 1000 }, "normal", function () {
            console.log("本次运动结束2");
        })
        $(".ball").eq(2).animate({ left: 1000 }, "fast", function () {
            console.log("本次运动结束3");
        })
        $(".ball").eq(3).animate({ left: 1000 }, 100, function () {
            console.log("本次运动结束4");
        })
    })



</script>

</html>